package io.ztd.net.androiduitest;

import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import java.util.UUID;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.ztd.net.androiduitest.opengl.OpenGLES20Activity;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.tv_click)
    TextView tvClick;
    @BindView(R.id.textView)
    TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.tv_click, R.id.textView})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_click:
                Toast.makeText(this, "点击事件", Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this, OpenGLES20Activity.class));
                break;

            case R.id.textView:
                String ANDROID_ID = Settings.System.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
                Log.d("MainActivity", ANDROID_ID);
                String s1 = UUID.randomUUID().toString();
                Log.d("MainActivity", s1);
                String s = Integer.toHexString(10000);
                Log.d("MainActivity == s", s);
                Toast.makeText(this, "滑动事件", Toast.LENGTH_SHORT).show();
                /*PackageManager pm = getPackageManager();
                String url = "netpas://packageid/com.twitter.android";

                try {
                    String packageId = url.substring("netpas://packageid/".length(), url.length());
                    pm.getPackageInfo(packageId, PackageManager.GET_ACTIVITIES);
                    Intent launchIntent = getPackageManager().
                            getLaunchIntentForPackage(packageId);
                    if (launchIntent != null) {
                        startActivity(launchIntent);
                    }
                } catch (Exception ignore) {}*/
                break;
        }
    }
}
